package cn.xuan.scan.dao.query.param;

import java.util.Collection;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Expression;

public class QueryExpressionUtil {
	public static Criterion equals(String key, Object value) {
		return Expression.eq(key, value);
	}

	public static Criterion between(String key, Object value1, Object value2) {
		return Expression.between(key, value1, value2);
	}

	public static Criterion idIs(Long value) {
		return Expression.idEq(value);
	}

	public static Criterion in(String key, Collection values) {
		return Expression.in(key, values);
	}

	public static Criterion isNotNull(String key) {
		return Expression.isNotNull(key);
	}

	public static Criterion isNull(String key) {
		return Expression.isNull(key);
	}

	public static Criterion like(String key, Object value) {
		return Expression.like(key, value);
	}

	public static Criterion notLike(String key, Object value) {
		return Expression.ilike(key, value);
	}

	public static Criterion notEquals(String key, Object value) {
		return Expression.not(Expression.eq(key, value));
	}

	public static Criterion lessThan(String key, Object value) {
		return Expression.lt(key, value);
	}

	public static Criterion notMoreThan(String key, Object value) {
		return Expression.le(key, value);
	}

	public static Criterion moreThan(String key, Object value) {
		return Expression.gt(key, value);
	}

	public static Criterion notLessThan(String key, Object value) {
		return Expression.ge(key, value);
	}

	public static Criterion eqProperty(String key1, String key2) {
		return Expression.eqProperty(key1, key2);
	}

	public static Criterion sql(String sql) {
		return Expression.sql(sql);
	}

	public static Criterion andExpression(Criterion expression1, Criterion expression2) {
		return Expression.and(expression1, expression2);
	}

	public static Criterion orExpression(Criterion expression1, Criterion expression2) {
		return Expression.or(expression1, expression2);
	}
}
